import { createRouter, createWebHistory, RouteRecordRaw } from "vue-router";

import userRoutes from "@/router/modules/user";
import logRoutes from "@/router/modules/log";

const routes: RouteRecordRaw[] = [
  {
    path: "/login",
    name: "LOGIN",
    component: () => import("@/views/login/index.vue"),
  },
  {
    path: "/",
    name: "LAYOUT",
    component: () => import("@/layout/index.vue"),
    children: [userRoutes, logRoutes],
  },
  {
    path: "/404",
    name: "NOT-FOUND",
    component: () => import("@/views/404/index.vue"),
  },
  { path: "/:pathMatch(.*)", redirect: "/404" },
];

const router = createRouter({
  history: createWebHistory(),
  routes,
});

export default router;
